#ifndef ASYNC_SCRIPT_EXECUTOR_PRIVATE_H
#define ASYNC_SCRIPT_EXECUTOR_PRIVATE_H
#include <qthread.h>
#include "ScriptExecutor.h"

class AsyncScriptExecutorPrivate : public QThread,public AsyncScriptExecutor
{
	Q_OBJECT
public:
	AsyncScriptExecutorPrivate(QObject* parent = nullptr);
	~AsyncScriptExecutorPrivate();
public:
    void setFinishedCallback(const std::function<void()>& cb);
    void execute(const QString& script);
    void stop();
    bool running()const;
public:
	AsyncScriptExecutorPrivate* getPrivateClass(){return this;}
signals:
	void asyncCallScript(const QString& item);
private:
	void run();
	int getSleepTime(const QString& script);
private:
	volatile bool running_ = false;
	std::function<void()> callback;
	QStringList command;
};

#endif